Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

string-split-by

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-split-by

Split string by any separator excluding brackets, quotes and escaped characters

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

string-split-by unstable Build Status

Split string by a separator with respect to brackets, quotes and escape markers. Optimized version of string-split.

Usage

npm install string-split-by

var split = require('string-split-by')

split('a."b.c".d.{.e.f.g.}.h', '.')
// ['a', '"b.c"', 'd', '{.e.f.g.}', 'h']

split('a."b.c".d.{.e.f.g.}.h', '.', {ignore: '""'})
// ['a', '"b.c"', 'd', '{', 'e', 'f', 'g', '}', 'h']

API

parts = splitBy(string, separator, options?)

Return array with parts split from string by a separator, which can be whether String or RegExp. Options can define:

OptionDefaultMeaning
ignore['"', "'", '`', '“”', '«»', '[]', '()', '{}']Avoid splitting content enclosed in the character pairs. Can be a string or a list of strings.
escapetrueAvoid splitting at the escaped separator, eg. \. won't be separated by '.' separator.

License

© 2018 Dmitry Yv. MIT License

Keywords

FAQs

Package last updated on 28 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc